<?php

namespace Api\Model;

use Think\Model;

class UserinfoModel extends Model {

    function addUserinfo($user_id, $username, $fname, $lname, $user_gender, $user_address, $user_tel) {
        $aname = $lname . $fname;
        $data = array(
            'user_id' => $user_id,
            'username' => $username,
            'user_fname' => $fname,
            'user_lname' => $lname,
            'user_aname' => $aname,
            'user_gender' => $user_gender,
            'user_address' => $user_address,
            'user_tel' => $user_tel,
            'createtime' => date('Y-m-d H:i:s')
        );
        $this->add($data);
    }

    function upUserinfo($user_id, $updata) {
        $this->where('id = ' . $user_id)->save($updata);
    }

    function getUserinfobyuserid($user_id) {
        $where = array('user_id' => $user_id);
        return $this->where($where)->find();
    }

}
